package com.toby.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @desc: 账户dao
 * @author: toby
 * @date: 2019/10/8 22:21
 */
@Repository
public class AccountDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public int updateAccountBalance(String accountId,double balance) {
        String sql = "update t_account set balance = balance - ? where account_id = ?";
        return jdbcTemplate.update(sql,balance,accountId);
    }
}
